package com.smart.client.runner;

import com.smart.client.core.client.IClient;
import lombok.RequiredArgsConstructor;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

/**
 * Created By Li Jiaxi
 * <br/>Date: 2023/4/12 11:10
 * <br/>Description:
 */
@RequiredArgsConstructor
@Component
public class NettyClientApplicationRunner implements CommandLineRunner {

    private final IClient client;

    @Override
    public void run(String... args) throws Exception {
        new Thread(() -> {
            try {
                client.start();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }, "tcp-client").start();
    }
}
